package com.china08.yxyapi.api.manage.tec.teaching.zujuan.zujuanlist;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.entity.mg.paper.Paper;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.repository.mg.PaperRepository;

/**
 * 组卷列表--删除试卷
 * 
 */
@CrossOrigin
@RestController
public class ZujuanListDelController extends YxyApiBaseController {

    @Autowired
    private PaperRepository paperRepository;

    @RequestMapping(value = "/api_yw/manage/tec/teaching/zujuan/zujuanlist/del", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespModel process(HttpServletRequest request, //
            HttpServletResponse response, //
            @RequestParam(value = "paperId", required = true) String paperId) {
        Paper paper = paperRepository.findOne(paperId);
        paper.setStatus(0);
        paperRepository.save(paper);
        RespModel respModel = new RespModel();
        respModel.setMessage("删除试卷成功");
        return respModel;
    }

    protected static class RespModel extends YxyApiRespModel {

    }

}
